{template '_header'}
<style type='text/css'>
    .ordertable { width:100%;position: relative;margin-bottom:10px}
    .ordertable tr td:first-child { text-align: right }
    .ordertable tr td {padding:10px 5px 0;vertical-align: top}
    .ordertable1 tr td { text-align: right; }
    .ops .btn { padding:5px 10px;}
</style>
<div class="page-heading"> <h2><i class="fa fa-circle-o"></i>订单详情</h2> </div>
{if $item['status']!=-1}
<div class="step-region" >
    <ul class="ui-step ui-step-4" >
        <li {if 0<=$item['status']}class="ui-step-done"{/if}>
        <div class="ui-step-title" >买家下单</div>
        <div class="ui-step-number" >1</div>
        <div class="ui-step-meta" >{if 0<=$item['status']}{php echo date('Y-m-d',$item['createtime'])}<br/>{php echo date('H:i:s',$item['createtime'])}{/if}</div>
        </li {if 1<=$item['status']}class="ui-step-done"{/if}>
        <li {if !empty($item['paytime'])}class="ui-step-done"{/if}>
        <div class="ui-step-title">买家付款</div>
        <div class="ui-step-number">2</div>
        <div class="ui-step-meta">{if 1<=$item['status']}{php echo date('Y-m-d',$item['paytime'])}<br/>{php echo date('H:i:s',$item['paytime'])}{/if}</div>
        </li>
        <li {if 2<=$item['status'] || ($item['status']==1 && $item['sendtype'] > 0)}class="ui-step-done"{/if}>
        <div class="ui-step-title">{if $item['isverify'] == 1}
            确认使用
            {elseif !empty($item['addressid'])}
            商家发货
            {elseif !empty($item['isvirtualsend']) || !empty($item['virtual'])}
            自动发货
            {else}
            确认取货
            {/if}</div>
        <div class="ui-step-number" >3</div>
        <div class="ui-step-meta" >{if 2<=$item['status'] || ($item['status']==1 && $item['sendtype'] > 0)}{php echo date('Y-m-d',$item['sendtime'])}<br/>{php echo date('H:i:s',$item['sendtime'])}{/if}</div>
        </li>
        <li {if 3<=$item['status']}class="ui-step-done"{/if}>
        <div class="ui-step-title">订单完成</div>
        <div class="ui-step-number" >4</div>
        <div class="ui-step-meta">{if 3<=$item['status']}{php echo date('Y-m-d',$item['finishtime'])}<br/>{php echo date('H:i:s',$item['finishtime'])}{/if}</div>
        </li>
    </ul>
</div>
{/if}
<form class="form-horizontal form" action="" method="post">
    <input type="hidden" name="id" value="{$item['id']}" />

    <input type="hidden" name="dispatchid" value="{$dispatch['id']}" />

    <div  class='row order-container'>
        <div class="order-container-left">
            <div class='panel-body' >
                <h4 class="m-t-none m-b">订单信息</h4>
                <div class="form-group" style='padding:0 10px;'>
                    <table class='ordertable' style='table-layout:fixed'>
                        <tr>
                            <td style='width:80px'>订单编号：</td>
                            <td>{$item['ordersn']}</td>
                        </tr>
                        <tr>
                            <td>订单金额：</td>
                            <td>￥{php echo number_format($item['price'],2)} &nbsp;&nbsp;<a data-toggle='popover' data-html='true' data-placement='right'
                                                                                           data-content="<table style='width:100%;'>
                <tr>
                    <td  style='border:none;text-align:right;'>商品小计：</td>
                    <td  style='border:none;text-align:right;'>￥{php echo number_format( $item['goodsprice'] ,2)}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>运费：</td>
                    <td  style='border:none;text-align:right;'>￥{php echo number_format( $item['olddispatchprice'],2)}</td>
                </tr>
                {if !$item['ispackage']}
                {if $item['taskdiscountprice']>0 }
                <tr>
                    <td  style='border:none;text-align:right;'>任务活动优惠：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['taskdiscountprice'],2)}</td>
                </tr>
                {/if}
                {if $item['discountprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>会员折扣：</td>
                    <td  style='border:none;text-align:right;'>-￥{php echo number_format( $item['discountprice'],2)}</td>
                </tr>
                {/if}
                {if $item['deductprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>积分抵扣：</td>
                    <td  style='border:none;text-align:right;'>-￥{php echo number_format( $item['deductprice'],2)}</td>
                </tr>
                {/if}
                {if $item['deductcredit2']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>余额抵扣：</td>
                    <td  style='border:none;text-align:right;'>-￥{php echo number_format( $item['deductcredit2'],2)}</td>
                </tr>
                {/if}
                {if $item['deductenough']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>商城满额立减：</td>
                    <td  style='border:none;text-align:right;'>-￥{php echo number_format( $item['deductenough'],2)}</td>
                </tr>
                {/if}
                {if $item['merchdeductenough']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>商户满额立减：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['merchdeductenough'],2)}</td>
                </tr>
                {/if}
                {if $item['couponprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>优惠券优惠：</td>
                    <td  style='border:none;text-align:right;'>-￥{php echo number_format( $item['couponprice'],2)}</td>
                </tr>
                {/if}
                {if $item['isdiscountprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>促销优惠：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['isdiscountprice'],2)}</td>
                </tr>
                {/if}
                {if $item['buyagainprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>重复购买优惠：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['buyagainprice'],2)}</td>
                </tr>
                {/if}
                    {if $item['seckilldiscountprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>秒杀优惠：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['seckilldiscountprice'],2)}</td>
                </tr>
                {/if}
                {/if}
                {if intval($item['changeprice'])!=0}
                <tr>
                    <td  style='border:none;text-align:right;'>卖家改价：</td>
                    <td  style='border:none;text-align:right;'><span style='{if 0<$item['changeprice']}color:green{else}color:red{/if}'>{if 0<$item['changeprice']}+{else}-{/if}￥{php echo number_format(abs($item['changeprice']),2)}</span></td>
                </tr>
                {/if}
                {if intval($item['changedispatchprice'])!=0}
                <tr>
                    <td  style='border:none;text-align:right;'>卖家改运费：</td>
                    <td  style='border:none;text-align:right;'><span style='{if 0<$item['changedispatchprice']}color:green{else}color:red{/if}'>{if 0<$item['changedispatchprice']}+{else}-{/if}￥{php echo abs($item['changedispatchprice'])}</span></td>
                </tr>
                {/if}
                <tr>
                    <td style='border:none;text-align:right;'>应收款：</td>
                    <td  style='border:none;text-align:right;color:green;'>￥{php echo number_format($item['price'],2)}</td>
                </tr>

            </table>
"><i class='fa fa-question-circle'></i></a></td>
                        </tr>

                        {if !empty($coupon)}
                        <tr>
                            <td>优惠券：</td>
                            <td>{if $coupon['merchid'] == 0}<a href="{php echo webUrl('sale/coupon/edit',array('id'=>$coupon['id']))}" target='_blank'>{$coupon['couponname']}</a>{else}{$coupon['couponname']}{/if} &nbsp;&nbsp;<a data-toggle='popover' data-html='true' data-placement='right'
                                                                                                                                                                      data-content="<table style='width:100%;'>

                <tr>
                    <td style='border:none;text-align:right;'>优惠方式：</td>
                    <td style='border:none;text-align:right;'>
                    {if $coupon['backtype']==0}
                        立减 {$coupon['deduct']} 元
                    {else if $coupon['backtype']==1}
                        打 {$coupon['discount']} 折
                    {else if $coupon['backtype']==2}
                        {if $coupon['backmoney']>0}返 {$coupon['backmoney']} 余额{/if}
                        {if $coupon['backcredit']>0}返 {$coupon['backcredit']} 积分{/if}
                        {if $coupon['backredpack']>0}返 {$coupon['backredpack']} 红包{/if}
                    {/if}
                    </td>
                </tr>


                {if $coupon['backtype']==2}
                    <tr>
                        <td style='border:none;text-align:right;'>返利方式：</td>
                        <td style='border:none;text-align:right;'>
                        {if $item['backwhen']==0}
                            交易完成后(过退款期限)
                        {else if $item['backwhen']==1}
                            订单完成后(收货后)
                        {else}
                            订单付款后
                        {/if}
                        </td>
                    </tr>

                    <tr>
                        <td style='border:none;text-align:right;'>返利情况：</td>
                        <td style='border:none;text-align:right;'>
                        {if empty($coupon['back'])}
                            未返利
                        {else}
                            已返利
                        {/if}
                        </td>
                    </tr>

                    {if !empty($coupon['back'])}
                    <tr>
                        <td style='border:none;text-align:right;'>返利时间：</td>
                        <td style='border:none;text-align:right;'>{php echo date('Y-m-d H:i',$coupon['backtime'])}</td>
                    </tr>
                    {/if}
                {/if}


            </table>
"><i class='fa fa-question-circle'></i></a></td>
                        </tr>
                        {/if}


                        <tr>
                            <td style='width:80px'>付款方式：</td>
                            <td> {if $item['paytype'] == 0}未支付{/if}
                                {if $item['paytype'] == 1}余额支付{/if}
                                {if $item['paytype'] == 11}后台付款{/if}
                                {if $item['paytype'] == 21}微信支付{/if}
                                {if $item['paytype'] == 22}支付宝支付{/if}
                                {if $item['paytype'] == 23}银联支付{/if}
                                {if $item['paytype'] == 3}货到付款{/if}</td>
                        </tr>

                        <tr>
                            <td>买家：</td>
                            <td><a href="{php echo webUrl('member/list/detail',array('id'=>$member['id']))}" target='_blank'>{$member['nickname']}</a> &nbsp;&nbsp;<a data-toggle='popover' data-html='true' data-placement='right'
                                                                                                                                                                      data-content="<table style='width:100%;'>
                <tr>
                    <td  style='border:none;text-align:right;' colspan='2'><img src='{$member['avatar']}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>ID：</td>
                    <td  style='border:none;text-align:right;'>{$member['id']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>昵称：</td>
                    <td  style='border:none;text-align:right;'>{$member['nickname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>姓名：</td>
                    <td  style='border:none;text-align:right;'>{$member['realname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>手机号：</td>
                    <td  style='border:none;text-align:right;'>{$member['mobile']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>微信号：</td>
                    <td  style='border:none;text-align:right;'>{$member['weixin']}</td>
                </tr>
                </table>
"><i class='fa fa-question-circle'></i></a></td>
                        </tr>
                        {if !empty($item['invoicename'])}
                        <tr>
                            <td style='width:80px'>发票抬头：</td>
                            <td>{$item['invoicename']}</td>
                        </tr>
                        {/if}
                    </table>

                    <table class='ordertable' style='table-layout:fixed;border-top:1px dotted #ccc'>

                        <tr>
                            <td style='width:80px'>配送方式：</td>
                            <td>
                                {if $item['isverify'] == 1}
                                    线下核销
                                {elseif !empty($item['addressid'])}
                                    快递
                                {elseif !empty($item['isvirtualsend']) || !empty($item['virtual'])}
                                    自动发货{if !empty($item['isvirtualsend'])}(虚拟物品){else}(虚拟卡密){/if}
                                {elseif $item['dispatchtype']}
                                    自提
                                {else}
                                    其他
                                {/if}
                            </td>
                        </tr>

                        {if $item['isverify']==1}
                            <tr>
                                <td style='width:80px'>核销方式：</td>
                                <td>{if $item['verifytype']==0}

                                    整单核销
                                    {elseif $item['verifytype']==1}
                                    按次核销
                                    {elseif $item['verifytype']==2}
                                    按消费码核销
                                    {/if}

                                </td>
                            </tr>

                            {if $item['verifytype']==0}
                                <tr>
                                    <td style='width:80px'>消费码：</td>
                                    <td>{$item['verifycode']}</td>
                                </tr>
                                {if $item['verified']}
                                <tr>
                                    <td style='width:80px'>核销时间：</td>
                                    <td>{php echo date('Y-m-d H:i:s', $item['verifytime'])}</td>
                                </tr>
                                {if !empty($saler)}
                                <tr>
                                    <td style='width:80px'>核销人：</td>
                                    <td>{$saler['nickname']}( {$saler['salername']} )</td>
                                </tr>
                                {/if}
                                {if !empty($store)}
                                <tr>
                                    <td style='width:80px'>核销门店：</td>
                                    <td>{$store['storename']}</td>
                                </tr>
                                {/if}
                            {/if}

                        {elseif $item['verifytype']==1}
                        <tr>
                            <td style='width:80px'>消费记录：</td>
                            <td>
                                <a href='javascript:;' onclick='$("#verify-modal").modal()'><i class="fa fa-question-circle"></i> 查看</a>

                                <div id="verify-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">

                                    <div class="modal-dialog" style='width:850px'>
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h3>核销记录</h3>
                                            </div>
                                            <div class="modal-body" >
                                                <div style='max-height:500px;overflow:auto;min-width:800px;'>
                                                    <table style='width:100%;' class='table'>
                                                        <tr><td style='width:150px'>时间</td><td style='width:100px'>核销员</td><td>门店</td></tr>
                                                        {loop $verifyinfo $v}
                                                            <tr><td>{php echo date('Y-m-d H:i',$v['verifytime'])}</td><td>{$v['salername']}<br/><small>{$v['nickname']}</small></td><td>{$v['storename']}</td></tr>
                                                        {/loop}
                                                    </table>
                                                </div>
                                            </div>
                                            <div class="modal-footer">

                                                <a href="#" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a>
                                            </div>
                                        </div>
                                    </div>

                                </div>

                            </td>
                        </tr>



                        {elseif $item['verifytype']==2}
                        <tr>
                            <td style='width:80px'>消费码：</td>
                            <td>{$item['verifycode']}</td>
                        </tr>
                        {loop $verifyinfo $v}
                        {if $v['verified']}
                        <tr>
                            <td style='width:80px'>{$v['verifycode']}</td>
                            <td>
                                <a data-toggle='popover' data-html='true' data-placement='right'
                                   data-content="<table style='width:100%;'>

                <tr>
                    <td  style='border:none;text-align:right;'>核销员：</td>
                    <td  style='border:none;text-align:right;'>{$v['salername']}/{$v['nickname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>门店：</td>
                    <td  style='border:none;text-align:right;'>{$v['storename']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>时间：</td>
                    <td  style='border:none;text-align:right;'>{php echo date('Y-m-d H:i',$v['verifytime'])}</td>
                </tr>

                </table>" ><i class="fa fa-question-circle"></i> 使用信息</a>
                            </td>
                        </tr>
                        {/if}
                        {/loop}

                        {/if}

                        {/if}

                        {if !empty($item['addressid'])}
                        <tr>
                            <td style='width:80px'>收货人：</td>
                            <td style='word-break: break-all;white-space: normal'>
                                {$user['address']}, {$user['realname']}, {$user['mobile']} <a class='js-clip' data-url="{$user['address']}, {$user['realname']}, {$user['mobile']}">[复制]</a></td>
                        </tr>

                        {elseif $item['isverify']==1 || !empty($item['virtual']) ||!empty($item['isvirtual'])}
                            {if $item['status']>=2 && !empty($item['virtual']) }
                                <tr>
                                    <td style='width:80px'>发货信息：</td>
                                    <td style='word-break: break-all;white-space: normal'>{php echo str_replace("\n","<br/>", $item['virtual_str'])}</td>
                                </tr>
                            {/if}

                            <tr>
                                <td style='width:80px'>联系人：</td>
                                <td style='word-break: break-all;white-space: normal'>{$user['carrier_realname']}, {$user['carrier_mobile']}</td>
                            </tr>
                        {else}
                            <tr>
                                <td style='width:80px'>自提码：</td>
                                <td>{$item['verifycode']}</td>
                            </tr>
                            <tr>
                                <td style='width:80px'>自提人：</td>
                                <td style='word-break: break-all;white-space: normal'>{$user['carrier_realname']} {$user['carrier_mobile']} </td>
                            </tr>
                            <tr>
                                <td style='width:80px'>自提点：</td>
                                <td style='word-break: break-all;white-space: normal'>{$user['address']},  {$user['realname']}, {$user['mobile']}</td>
                            </tr>
                        {/if}

                        {if !empty($item['remark'])}
                        <tr>
                            <td style='width:80px'>买家备注：</td>
                            <td style='word-break: break-all;white-space: normal'>{$item['remark']}</td>
                        </tr>
                        {/if}

                        {if !empty($item['addressid'])}
                        {ifp 'order.op.changeaddress'}
                        <tr>
                            <td style='width:80px'></td>
                            <td style='word-break: break-all;white-space: normal'>{if $item['merchid'] == 0}<a class="btn btn-primary btn-xs" data-toggle="ajaxModal" href="{php echo webUrl('order/op/changeaddress', array('id' => $item['id']))}">编辑收货信息</a>{/if}</td>
                        </tr>
                        {/if}
                        {/if}

                    </table>

                    {if !empty($order_data)}
                    <table class='ordertable' style='table-layout:fixed;border-top:1px dotted #ccc'>
                        <tr>
                            <td style='width:120px'><h4>统一下单信息</h4></td>
                            <td></td>
                        </tr>
                        {php $datas = $order_data}
                        {php $ii = 0;}
                        {loop $order_fields $key $value}

                        <tr {if $ii>1}class="diymore2" style="display:none;"{/if}>
                            <td style='width:80px'>{php echo $value['tp_name']}：</td>
                            <td style="white-space: normal;">
                                {template 'diyform/diyform'}

                            </td>
                        </tr>

                        {if $ii==2}
                        <tr class="diymore22">
                            <td colspan="2"><a href="javascript:void(0);" style="padding-right: 100px;" id="showdiymore2">查看完整信息</a></td>
                        </tr>
                        {/if}

                        {php $ii++;}
                        {/loop}
                    </table>
                    {/if}
                </div>
            </div>
        </div>

        <div class="order-container-right" >
            <div class='panel-body' >
                <div class='row'>
                    <div class='col-sm-3 control-label' style='padding-top:10px;'>订单状态: </div>
                    <div class="col-sm-9 col-xs-12">
                        <h3 class="form-control-static">
                            {if $item['status'] == 0}
                            {if $item['paytype']==3}
                            <span class="text-default">待发货</span>
                            {else}
                            <span class="text-default">待付款</span>
                            {/if}
                            {/if}
                            {if $item['status'] == 1}
                                <span class="text-danger">
                                {if $item['isverify'] == 1}
                                    待使用
                                {else if empty($item['addressid'])}
                                    待取货
                                {else}
                                    {if $item['sendtype'] > 0}部分发货{else}待发货{/if}
                                {/if}
                                </span>
                            {/if}
                            {if $item['status'] == 2}<span class="text-warning">待收货</span>{/if}
                            {if $item['status'] == 3}<span class="text-primary">交易完成</span>{/if}
                            {if $item['status'] == -1}
                            <span class="text-default">已关闭</span>
                            {/if}
                        </h3>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        <div class="form-control-static">

                            {if $item['status'] == 0}
                            {if $item['paytype']==3}
                            此订单为货到付款订单，请商家尽快发货
                            {else}
                            等待买家付款
                            {/if}
                            {/if}
                            {if $item['status'] == 1 && $item['sendtype'] == 0}买家已经付款，请商家尽快发货{/if}
                            {if $item['status'] == 2 || ($item['status']==1 && $item['sendtype'] > 0)}商家已发货，等待买家收货并交易完成{/if}
                            {if $item['status'] == -1}
                            {if !empty($refund) && $refund['status']==1}
                            <span class="label label-default">已退款</span> {if !empty($refund['refundtime'])}退款时间: {php echo date('Y-m-d H:i:s',$refund['refundtime'])}{/if}
                            {/if}
                            {/if}
                        </div>
                        {if empty($order_goods)}
                        {if !empty($item['expresssn']) && $item['status']>=2 && !empty($item['addressid'])}
                        <div class="form-control-static">
                            快递公司: {if empty($item['expresscom'])}其他快递{else}{$item['expresscom']}{/if}<br>
                            快递单号: {$item['expresssn']} &nbsp;&nbsp;<a class='op' data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn']))}">查看物流</a><br>
                            发货时间: {php echo date('Y-m-d H:i:s', $item['sendtime'])}
                        </div>
                        {/if}
                        {else}
                        {loop $order_goods $index $og}
                        <label class="text-danger">
                            包裹{php echo chr($index+65)}
                            <a data-toggle='popover' data-trigger="hover" data-html='true' data-placement='right'
                               data-content="<table style='width:100%;'>
               {loop $og['goods'] $g}
                <tr>
                    <td  style='border:none;text-align:right;padding:0 5px 2px 0;'><img src='{php echo tomedia($g['thumb'])}' width='25' height='25' alt=''></td>
                    <td  style='border:none;white-space: normal;'>{$g['title']}</td>
                </tr>
                {/loop}
            </table>"><i class='fa fa-question-circle'></i></a>
                        </label>
                        <div class="form-control-static" style="padding-left:20px;">
                            快递公司: {if empty($og['expresscom'])}其他快递{else}{$og['expresscom']}{/if}<br>
                            快递单号: {$og['expresssn']} &nbsp;&nbsp;
                            <a class='op' data-toggle="ajaxModal" href="{php echo webUrl('util/express',array('id' => $og['orderid'],'express'=>$og['express'],'expresssn'=>$og['expresssn'],'sendtype'=>$og['sendtype']))}">查看物流</a><br>
                            发货时间: {php echo date('Y-m-d H:i:s', $og['sendtime'])}
                        </div>
                        {/loop}

                        {/if}
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-3 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static ops">
                            {if $item['merchid'] == 0 && $item['ismerch'] == 0}
                            {php $detial_flag = 1}{template 'order/ops'}
                            &nbsp;&nbsp;
                            {if $item['status'] ==0 && $item['ispackage']==0}
                            {ifp 'order.op.changeprice'}
                            <a class='op'  data-toggle='ajaxModal' href="{php echo webUrl('order/op/changeprice',array('id'=>$item['id']))}">订单改价</a>&nbsp;&nbsp;
                            {/if}
                            {/if}
                            {if !empty($item['agentid'])}
                            {ifp 'commission.changecommission'}
                            <a data-toggle="ajaxModal"  href="{php echo webUrl('commission/apply/changecommission', array('id' => $item['id']))}">修改佣金</a>&nbsp;&nbsp;
                            {/if}
                            {/if}
                            {ifp 'order.op.remarksaler'}
                            <a  data-toggle="ajaxModal" href="{php echo webUrl('order/op/remarksaler', array('id' => $item['id']))}" {if !empty($item['remarksaler'])}style='color:red'{/if} >备注</a>
                            {/if}
                            {/if}
                        </p>
                    </div>
                </div>


                {if $item['status'] >0}
                <div class='order-tips' style="position: inherit;">
                    <div class='row order-tips-title'>友情提醒</div>

                    {if $item['status'] == 0}
                    {if $item['paytype']==3}
                    <div class='row order-tips-row'>订单为货到付款，请您务必联系买家确认后再进行发货</div>
                    {else}
                    <div class='row order-tips-row'>您可以联系买家进行付款，否则订单会根据设置自动关闭</div>
                    {/if}
                    {/if}
                    {if $item['status'] == 1}
                    <div class='row order-tips-row'>如果无法进行发货，请及时联系买家进行妥善处理;</div>
                    {/if}
                    {if $item['status'] == 2}
                    <div class='row order-tips-row'>请及时关注物流状态，确保买家及时收到商品;</div>
                    <div class='row order-tips-row'>如果买家未收到货物或有退换货请求，请及时联系买家妥善处理</div>
                    {/if}

                    {if $item['status']==3}
                    <div class='row order-tips-row'>交易成功，如买家有售后申请，请与买家进行协商，妥善处理</div>
                    {/if}
                </div>
                {/if}


            </div>

        </div>

    </div>

    <br>

    {if p('commission') && count($agents)>0}

    <div  class='row order-container'>
        <div class="row" style="margin: 20px 0 0 10px;">

            {loop $agents $key $value}

            <div class="col-sm-4">

                {if !empty($value)}
                <h4 class="m-t-none m-b">
                    {if $key == 0}
                    一级分销商
                    {else if $key == 1}
                    二级分销商
                    {else if $key == 2}
                    三级分销商
                    {/if}
                </h4>
                <div class="form-group" style='padding:0 10px;'>
                    <table class='ordertable' style='table-layout:fixed'>
                        <tr>
                            <td style='width:80px'>姓名：</td>
                            <td><a href="{php echo webUrl('member/list/detail',array('id'=>$value['id']))}" target='_blank'>{$value['realname']}</a> &nbsp;&nbsp;<a data-toggle='popover' data-html='true' data-placement='right'
                                                                                                                                                                    data-content="<table style='width:100%;'>

                <tr>
                    <td  style='border:none;text-align:right;' colspan='2'><img src='{$value['avatar']}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>ID：</td>
                    <td  style='border:none;text-align:right;'>{$value['id']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>昵称：</td>
                    <td  style='border:none;text-align:right;'>{$value['nickname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>姓名：</td>
                    <td  style='border:none;text-align:right;'>{$value['realname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>手机号：</td>
                    <td  style='border:none;text-align:right;'>{$value['mobile']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>微信号：</td>
                    <td  style='border:none;text-align:right;'>{$value['weixin']}</td>
                </tr>
                </table>
"><i class='fa fa-question-circle'></i></a></td>
                        </tr>

                        <tr>
                            <td style='width:80px'>手机号：</td>
                            <td>{$value['mobile']}</td>
                        </tr>

                        <tr>
                            <td style='width:80px'>佣金：</td>
                            <td>{$value['commission']}</td>
                        </tr>

                    </table>
                </div>
                {/if}

            </div>
            {/loop}
        </div>

    </div>
    <br>
    {/if}


    <div class="panel panel-default">
        <div class="panel-heading">
            <span>商品信息</span>
            {if $item['ispackage']}
            <span class="text-danger" style="color:red;">（套餐优惠价：&yen;{php echo number_format($item['price'],2)}{if $item['dispatchprice'] }，含运费：&yen;{php echo number_format($item['dispatchprice'],2)}{/if}）</span>
            {/if}
        </div>
        <div class="panel-body table-responsive">
            <table class="table table-hover">
                <thead class="navbar-inner">
                <tr>
                    <th style="width:200px">标题</th>
                    <th>规格/编号/条码</th>
                    <th style="text-align: center;">单价(元)/数量</th>
                    <th style="text-align: center;">{if $item['ispackage']}商品价格(元){else}折扣前/折扣后(元){/if}</th>

                    {if !empty($goods['diyformdata']) && $goods['diyformdata'] != 'false'}
                    <th style="width:80px;"></th>
                    {/if}
                    <!--<th style="width:5%;">操作</th>-->
                </tr>
                </thead>
                {php $i=0;}
                {loop $item['goods'] $goods}
                <tr>
                    <td class='full'>
                        {if $goods['seckill_task']}
                        <span class="label label-danger">{$goods['seckill_task']['tag']}</span>
                        {if $goods['seckill_room']}<span class="label label-primary">{php echo $goods['seckill_room']['tag']?:$goods['seckill_room']['title']}</span>{/if}

                        <br/>{/if}

                        {if $category[$goods['pcate']]['name']}
                        <span class="text-error">[{$category[$goods['pcate']]['name']}] </span>{/if}{if $children[$goods['pcate']][$goods['ccate']][1]}
                        <span class="text-info">[{$children[$goods['pcate']][$goods['ccate']][1]}] </span>
                        {/if}
                        <a target="_blank" href="{php echo webUrl('goods/edit', array('id' => $goods['id']))}"title="查看">{$goods['title']}</a>
                        {if !empty($goods['invoice'])}<label class='label label-danger'>支持开票</label>{/if}
                    </td>
                    <td class='full'>
                        {if !empty($goods['optionname'])}
                        <span style="white-space:normal;">规格：
                            <button type="button" class="btn btn-primary" data-container="body" data-toggle="popover" data-placement="right"
                                    data-content="{$goods['optionname']}" data-original-title="" title=""
                                    style="word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:90px;padding:0 3px;">
                                {$goods['optionname']}
                            </button>
                        </span>
                        {/if}
                        {if !empty($goods['goodssn'])}<br/>编码:{$goods['goodssn']}{/if}
                        {if !empty($goods['productsn'])}<br/>条码:{$goods['productsn']}{/if}</td>
                    <td style="text-align: right;">{$goods['marketprice']}
                        <br/>x{$goods['total']}</td>
                    <td style='color:red;font-weight:bold;text-align: right;'>
                        {if $item['ispackage']}
                            &yen;{php echo number_format($goods['marketprice'],2)}
                        {else}
                            {$goods['orderprice']}/{$goods['realprice']}
                            {if intval($goods['changeprice'])!=0}
                            <br/>(改价{if $goods['changeprice']>0}+{/if}{php echo number_format(abs($goods['changeprice']),2)})
                            {/if}
                        {/if}
                    </td>

                    {if !empty($goods['diyformdata']) && $goods['diyformdata'] != 'false'}
                    <td>
                        <a href='javascript:;' class=btn-xs' hide="1"  data="{$i}" onclick="showDiyInfo(this)">自定义信息</a>
                    </td>
                    {/if}
                    <!--td>
                        <a href="{php echo webUrl('goods/edit', array('id' => $goods['id']))}" class="btn btn-default btn-sm" title="编辑"><i class="fa fa-edit"></i></a>&nbsp;&nbsp;
                    </td-->
                </tr>

                {if !empty($goods['diyformdata']) && $goods['diyformdata'] != 'false'}
                <tr>
                    <td colspan='5'>
                        <table class='ordertable' style='table-layout:fixed;display: none;' id="diyinfo_{$i}">
                            {php $datas = $goods['diyformdata']}
                            {loop $goods['diyformfields'] $key $value}
                            <tr>
                                <td style='width:80px'>{php echo $value['tp_name']}：</td>
                                <td>
                                    {template 'diyform/diyform'}
                                </td>
                            </tr>
                            {/loop}
                        </table>
                    </td>
                </tr>
                {/if}
                {php $i++;}
                {/loop}

            </table>
        </div>
    </div>
</form>

<script language='javascript'>
    $(function () {
        $("#showdiymore1").click(function () {
            $(".diymore1").show();
            $(".diymore11").hide();
        });

        $("#showdiymore2").click(function () {
            $(".diymore2").show();
            $(".diymore22").hide();
        });
    });

    function showDiyInfo(obj){
        var data = $(obj).attr('data');
        var id = "diyinfo_" + data;

        var hide = $(obj).attr('hide');
        if(hide=='1'){
            $("#"+id).slideDown();
        }
        else{
            $("#"+id).slideUp();
        }
        $(obj).attr('hide',hide=='1'?'0':'1');
    }
    document.getElementById('asd').className();
</script>

{template '_footer'}
